package com.rbac.modules.system.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.rbac.modules.system.entity.SysUserRole;
import com.rbac.modules.system.mapper.SysUserRoleMapper;
import com.rbac.modules.system.service.SysUserRoleService;
import org.springframework.stereotype.Service;

@Service
public class SysUserRoleServiceImpl extends ServiceImpl<SysUserRoleMapper, SysUserRole> implements SysUserRoleService {
    
    @Override
    public void addUserRole(Long userId, Long roleId) {
        SysUserRole userRole = new SysUserRole();
        userRole.setUserId(userId);
        userRole.setRoleId(roleId);
        save(userRole);
    }
    
    @Override
    public void removeUserRole(Long userId, Long roleId) {
        lambdaUpdate()
            .eq(SysUserRole::getUserId, userId)
            .eq(SysUserRole::getRoleId, roleId)
            .remove();
    }
} 